<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>一个小网页</title>
</head>
<style>
    #ctn{
        width: 300px;
        height: 200px;
        margin: auto;
        margin-top: 20%;
        overflow: hidden;       
    }
    #imgbox{
        width: 900px;
        height: 300px;
    }
#imgbox .demo{
    float: left;
    width: 300px;
    height: 200px;
}
.demo{
    background-image: url(img/3.jpg);
    background-size: cover;
}
.demo:hover{
    background-image: url(img/6.jpg);
 
}

</style>
</head>
<body>
    <div id="ctn">
        <div id="imgbox">
            <a href="www.baidu.com">
                <div class="demo">

                </div>
            </a>

        </div>
    </div>
</body>
</html>